﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<div id="price"></div>
<div id="listOrders"></div>
<script type="text/javascript">
    $("#price").price();
    var widget = $("#listOrders").product({ render: function (event) {

        $("#delBasket").click(function () {
            var idbasket = $("#basketId")[0].value;
            var basket = { Id: idbasket };
            widget.deleteBasket(basket);
        });

        $("#completedBasket").click(function () {
            widget.compliteBasket();
        });

    }
    });




 
</script>

<script id="orderTmpl" type="text/x-jQuery-tmpl">

    <table>
        <tr>
            <th>
                User
            </th>
            <th>
                Product
            </th>
            <th></th>
        </tr>

        <tr>
            <td>
                ${User}
            </td>
            <td>
                {{each OrderPosition}}
                    ${Product} - ${Count}
                {{/each}}
            </td>
            <td>
                    <input type="hidden" id="basketId" value="${Id}">
            </td>
        </tr>
    </table>

    <input id="delBasket" type="button" value="Delete"> 
    <input id="completedBasket" type="button" value="Completed"> 

</script>

<script id="priceTmpl" type="text/x-jQuery-tmpl">
    Price: ${Price}
</script>











